<template>

    <el-button type="primary" @click="handleLogin">测试登录</el-button>
    <el-button type="primary" @click="handleUserList">测试获取数据</el-button>
  </template>
  
  
  <script setup >
  import requestUtil from '../utils/request'

  const handleLogin=async()=>{
    let result=await requestUtil.get("testjwt")
    let data=result.data;
    if( data.code==200){
      const token=data.token
      console.log("登录成功，token="+token)
      window.sessionStorage.setItem("token",token)
    }else{
      console.log("登录出错")
    }
  }
  
  const handleUserList=async ()=>{
    let result=await requestUtil.get("test")
    let data=result.data;
    if( data.code==200){
      const userList=data.data;
      console.log("用户信息列表，userList="+userList)
    }else{
      console.log("登录出错")
    }
  }
  </script>
  
  
  
  <style scoped>
  </style>
  